﻿@model Property4U.Models.Bid

@{
    ViewBag.Title = "Create";
}

<div class="row">
    <!-- Page Header -->
    <div class="col-lg-12">
        <h1 class="page-header">@ViewBag.Title</h1>
    </div>
    <!--End Page Header -->
</div>

@using (Html.BeginForm()) 
{
    @Html.AntiForgeryToken()
    
    <div class="form-horizontal">
        <h4>Bid</h4>
        <hr />
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
        <div class="form-group">
            @Html.LabelFor(model => model.BiddingID, "BiddingID", htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.DropDownList("BiddingID", (SelectList)ViewBag.BiddingIDList, String.Empty, htmlAttributes: new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.BiddingID, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.MemberID, "MemberID", htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.DropDownList("MemberID", (SelectList)ViewBag.MemberIDList, String.Empty, htmlAttributes: new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.MemberID, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Description, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Price, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Price, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.Price, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.BidOn, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.BidOn, new { htmlAttributes = new { @class = "form-control", @Value = ViewBag.BidOn, @readonly = "readonly" } })
                @Html.ValidationMessageFor(model => model.BidOn, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.BidStatus, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EnumDropDownListFor(model => model.BidStatus, "Process", htmlAttributes: new { @class = "form-control", @disabled = "disabled" })
                @Html.HiddenFor(model => model.BidStatus, new { id = "BidStatus", @Value = ViewBag.BidStatus })
                @Html.ValidationMessageFor(model => model.BidStatus, "", new { @class = "text-danger" })
            </div>
        </div>

        @Html.HiddenFor(model => model.LastEdit)

        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <input type="submit" value="Create" class="btn btn-default" />
            </div>
        </div>
    </div>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section scripts{
    @* Check url parameter reportAbuse isNumeric and set defualts EnumDropDownListFor  *@
    <script type="text/javascript">
            $(function () {
                if ($.isNumeric("@Request.Params["BID"]")) {
                    $("#BiddingID").val('@Request.Params["BID"]');
                }
            });
    </script>
}